import React from 'react';
import ReactDOM from 'react-dom/client';
import './index.css';
import { Route, BrowserRouter, Routes, Navigate } from 'react-router-dom';
import App from './App';
import Login from "./open-type/login";

const status = localStorage.getItem('status' as string)

const root = ReactDOM.createRoot(
  document.getElementById('root') as HTMLElement
);
root.render(
  <BrowserRouter>
    <Routes>
      <Route path='/' element={<Navigate to={'/login'} />}></Route>
      <Route path='/*' element={status == '1' ? <App /> : <Navigate to={'/login'} />}></Route>
      <Route path="/login" element={<Login />}></Route>
    </Routes>
  </BrowserRouter>
);

